from time import sleep
from page_locators.school_honor_locator import SchoolHonorLocator as SHL
from common.base_page import BasePage 
from test_datas.string_datas import *
from test_datas.pic_data import *


class SchoolHonor(BasePage):

    def __init__(self, driver):
        super().__init__(driver)
        
    def school_honor_click(self):
        self.click(SHL.school_honor, "学校荣誉定位点击")

    def add_honous_click(self):
        self.click(SHL.add_honor, '添加荣誉按钮定位失败截图')

    def honous_name_error1(self):
        self.add_honous_click()
        self.input(SHL.honous_name, character_31, "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")

    def honous_name_error2(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")

    def honous_name_error3(self):
        self.add_honous_click()
        self.input(SHL.honous_name, " ", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")

    def honous_name_success1(self):
        self.add_honous_click()
        self.input(SHL.honous_name, character_30, "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, character_30, "名称查询输入框定位输入")

    def honous_name_success2(self):
        self.add_honous_click()
        self.input(SHL.honous_name, character_29, "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, character_29, "名称查询输入框定位输入")

    def honous_name_success3(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "#$`", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, "#$`", "名称查询输入框定位输入")
        
    def coverpic_error1(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "貌美如花", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, webp_path, "上传封面定位失败截图")
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")

    def coverpic_error2(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "多才多艺", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, big_path, "上传封面定位失败截图")
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")

    def coverpic_error3(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "乐于助人", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, facepic_2MB, "上传封面定位失败截图")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, "乐于助人", '名称查询输入框定位输入')

    # 删除列表第一个
    def delete_honours_list_first(self):
        self.suspension_loc(SHL.honours1, SHL.honour_del, "荣誉列表第一条悬浮定位点击")
        self.click(SHL.sure_del, "确定删除按钮点击")

    def notes_error1(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "优秀学校", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        self.input(SHL.note, character_101, "备注输入框定位输入")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, "优秀学校", "名称查询输入框定位输入")

    def notes_success1(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "作风良好", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        self.input(SHL.note, character_100, "备注输入框定位输入")
        sleep(1)
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, "作风良好", "名称查询输入框定位输入")

    def notes_success2(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "科技创新", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        self.input(SHL.note, character_99, "备注输入框定位输入")
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, "科技创新", "名称查询输入框定位输入")

    def notes_success3(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "模范学校", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        self.input(SHL.note, ' ', "备注输入框定位输入")
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, "模范学校", "名称查询输入框定位输入")

    def notes_success4(self):
        self.add_honous_click()
        self.input(SHL.honous_name, "先进学校", "荣誉名称输入框定位失败截图")
        self.upload_file(SHL.upload_pic, cover_pic, "上传封面定位失败截图")
        self.input(SHL.note, '', "备注输入框定位输入")
        self.click(SHL.sure, "添加荣誉确定按钮定位失败截图")
        sleep(1)
        self.input(SHL.names, "先进学校", "名称查询输入框定位输入")

    def name_fuzzy_query(self):
        self.input(SHL.names, "学校", "名称输入框定位输入")
        sleep(1)


    def name_precise_query(self):
        self.input(SHL.names, "模范学校", "名称输入框定位输入")
        sleep(1)

    def name_blank_query(self):
        self.honous_name_error3()
        self.input(SHL.names, " ", "名称输入框定位输入")
        sleep(1)